from numba import jit, int32
from datetime import datetime

n = 15


@jit(int32(int32, int32, int32, int32, int32), nopython=True)
def Dfs(row, shu, pie, na, cnt):
    ave = ((1 << n) - 1) & ~(shu | pie | na)
    while ave:
        p = ave & -ave
        ave ^= p
        if row == n:
            cnt += 1
        else:
            cnt = Dfs(row + 1, shu | p, (pie | p) >> 1, (na | p) << 1, cnt)
    return cnt


start = datetime.now()
t = Dfs(1, 0, 0, 0, 0)
end = datetime.now()
print(t)
print(end - start)
print((end - start).seconds*1000+(end - start).microseconds/1000, "ms")
